package com.zenaprod.twodcore.ui;


import javax.swing.*;
import java.awt.*;

public class GameFrame extends JFrame {
    private static Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    private GameView gameView;


    public GameFrame(String title, GameView gameView, boolean centered) {
        super(title);
        this.gameView = gameView;

        int x = centered ? (int) ((screenSize.getWidth() - gameView.getWidth()) / 2) : 0;
        int y = centered ? (int) ((screenSize.getHeight() - gameView.getHeight()) / 2) : 0;


        System.out.println("centered ? (int) (("+screenSize.getWidth()+" - "+gameView.getWidth()+") / 2)");

        setBounds(x, y, gameView.getWidth(), gameView.getHeight());

        setUndecorated(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        setVisible(true);

        getContentPane().add(gameView);
        pack();
    }


}
